﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace HotelManageSystem.Models
{
    public class FinanceModel
    {
        public int Id { get; set; }

        [Display(Name = "类型")]
        public string Display
        {
            get
            {
                if (Type == -1)
                {
                    return "支出";
                }
                return "结余";
            }
        }

        //在添加数据时,用-1和+1表示收入和支出,在数据库中用正负来表示收入和支出
        public int Type { get; set; }

        [Display(Name = "数额")]
        [RegularExpression(@"^\d+(\.\d+)?$", ErrorMessage = "必须输入数字")]
        public decimal Income { get; set; }

        [Display(Name = "日期")]
        [DataType(DataType.Date)]
        public DateTime FinanceDate { get; set; }

        [Display(Name = "备注")]
        [StringLength(50, ErrorMessage = "长度不能超过50个字符")]
        public string Remark { get; set; }
    }
}